/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.easyedu.dictionary.explorer.nodes;

import eu.easyedu.dictionary.api.model.Dictionary;
import eu.easyedu.dictionary.api.resources.Bundle;
import org.openide.nodes.Node.Property;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
import org.openide.util.Exceptions;

/**
 *
 * @author hlavki
 */
public class DictionarySheet {

    private Dictionary dictionary;
    /* sheet sets/categories */
    private Sheet sheet;
    private Sheet.Set info;

    DictionarySheet(Dictionary dictionary) {
        this.dictionary = dictionary;
        sheet = Sheet.createDefault();
        info = Sheet.createPropertiesSet();
        createSheet();
    }

    private void createSheet() {
        info.setName("info"); //NOI18N
        info.setDisplayName(Bundle.getMessage("DictionarySheet.info.name"));
        try {

            Property<String> nameProp = new PropertySupport.Reflection<String>(dictionary, String.class, "getName", null);//NOI18N
            nameProp.setName("name"); //NOI18N
            nameProp.setDisplayName(Bundle.getMessage("DictionarySheet.nameProperty.name"));
            info.put(nameProp);
//            PropertySupport.Reflection<String> levelProp = new PropertySupport.Reflection<String>(dictionary, String.class, "getLevel", "setLevel");//NOI18N
//            nameProp.setName("level"); //NOI18N
//            levelProp.setDisplayName(bundle.getString("Logger_Level_prop"));
//            levelProp.setPropertyEditorClass(LevelPropertyEditor.class);

//            info.put(levelProp);
        } catch (NoSuchMethodException ex) {
            Exceptions.printStackTrace(ex);
        }
        sheet.put(info);
    }

    public Sheet getSheet() {
        return sheet;
    }
}
